package com.kulian.Signalling.system.service.impl.socket;

import com.kulian.Signalling.system.service.CallControlService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * WebSocket信令适配器实现
 */
@Primary
@Component
public class WebSocketSignalingAdapter implements CallControlService {
    private final WebSocketServiceImpl webSocketService;

    public WebSocketSignalingAdapter(WebSocketServiceImpl webSocketService) {
        this.webSocketService = webSocketService;
    }

    @Override
    public void initiateCall(String caller, String callee) {
        webSocketService.initiateCall(caller, callee);
    }

    @Override
    public void acceptCall(String callee, String caller) {
        webSocketService.acceptCall(callee, caller);
    }

    @Override
    public void rejectCall(String callee, String caller, String reason) {
        webSocketService.rejectCall(callee, caller, reason);
    }

    @Override
    public void endCall(String userId, String callId) {
        webSocketService.endCall(userId, callId);
    }

    @Override
    public void sendMediaOffer(String userId, String callId, String sdpOffer) {
        webSocketService.sendMediaOffer(userId, callId, sdpOffer);
    }

    @Override
    public void sendIceCandidate(String userId, String callId, String candidate) {
        webSocketService.sendIceCandidate(userId, callId, candidate);
    }
}
